package test.pcs;

import com.payment.lc.pcs.client.wrap.service.ProductionWrapService;
import com.payment.lc.pcs.common.enums.NoticeType;
import com.payment.lc.pcs.service.api.DynamicDataService;
import com.payment.lc.pcs.service.api.MaintainService;
import com.payment.lc.pcs.service.api.NoticeService;
import com.payment.lc.pcs.service.api.ProductionService;
import com.payment.lc.pcs.service.api.fund.JMFundService;
import com.payment.lc.pcs.service.bo.ProductionSellInfo;
import com.payment.lc.pcs.service.bo.ProductionValue;
import com.payment.lc.pcs.service.domain.ListWrapper;
import com.payment.lc.pcs.service.domain.Notice;
import com.payment.lc.pcs.service.domain.Production;
import net.rubyeye.xmemcached.MemcachedClient;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import priv.demos.demo1.solution.domain.Domain1;
import test.BaseTest;

import java.text.SimpleDateFormat;
import java.util.ArrayList;

/**
 * Created on 2016/8/8.
 */
public class Demo1PcsTest2 extends BaseTest {
    private SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");

    @Autowired
    ProductionService productionService;

    @Autowired
    DynamicDataService dynamicDataService;

    @Autowired
    JMFundService jmFundService;

    @Autowired
    ProductionWrapService productionWrapService;

    @Autowired
    MaintainService maintainService;

    @Autowired
    NoticeService noticeService;

    @Autowired
    MemcachedClient pcsProductionMemeryClient;

    @Test
    public void test() {
        test1();
    }

    void test3() {
        Production production = productionService.getProduction("KT10009");
        ProductionSellInfo sellInfo = productionWrapService.getProductionSellInfo("KT10009");
        print(sellInfo);
    }

    void test5() {
        ListWrapper<Notice> noticesByNoticeType = noticeService.getNoticesByNoticeType(NoticeType.Production);
        print(noticesByNoticeType);
    }

    void test4() {
        Object sellDataV2 = dynamicDataService.getProductionValue("SF3508");
        print(sellDataV2);
    }

    void test1() {
        ProductionSellInfo productionSellInfo = productionWrapService.getProductionSellInfo("SF2883",false);
        print(productionSellInfo);
    }

    void test2() {
        ProductionValue pv = dynamicDataService.getProductionValue("SF2885");
        print(pv);
    }


    void test6() {
        String key = "Demo1PcsTest2-abc";
        Domain1 domain1 = new Domain1();
        domain1.setAbc("abc");
        domain1.setBcd(new ArrayList<String>());
        {
            domain1.getBcd().add("a");
            domain1.getBcd().add("b");
            domain1.getBcd().add("c");
        }
//        domain1.setXxx("xxx");

        try {

//            boolean flag = pcsProductionMemeryClient.set(key, 0, domain1);
            Object o = pcsProductionMemeryClient.get(key);
            print(o);
//            Object obj = pcsProductionMemeryClient.get("com.payment.lc.pcs.productiongetFundProdCode-001666_JM10101");
//            print(obj);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}